
/**
 *
 * @Describe  调用小程序jssdk服务层
 * @Time  2019-09-11
 * @Author  zpw
 *
 */

import req from './dispatch'
import { urlGrafting,getUrlParam } from '../yd-utils/example'


//获取用户信息
export const getUserInfo = async (param) => {
	//url上带有用户code则直接返回给h5即可
    if(!getUrlParam("authCode")){
    	let url = urlGrafting("../test/test?",param);
		req.dispatch(url);
    }else{
    	return  {
		    		"authCode" : getUrlParam("authCode"), //支付宝授权码
		    		"avatar" : getUrlParam("avatar"), //图像
		    		"nickName" : getUrlParam("nickName"), //支付宝昵称
		    		"msg" : "用户信息获取成功",
		    		"code" : "200"
		    	}
    }
};

//唤起支付
export const wakeUpPayment = async (param) => {
	let url = urlGrafting("../test/test?",param);
	req.dispatch(url);
};

//唤起卡劵
export const wakeUpCardPackage = async (param) => {
	req.dispatch(param);
};
